package com.whz.serial;

import lombok.extern.slf4j.Slf4j;

import java.io.*;

/**
 * @ClassName StringListMainTest
 * @Description TODO
 * @Author hong-zhi
 * @Date 2021/5/26 17:49
 * @Version 1.0
 */
@Slf4j
public class StringListMainTest {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        StringListReason slr = new StringListReason();
        slr.add("whz");
        slr.add("jkb");
        slr.add("zzy");
        slr.add("sxm");
        String filePath = "d://StringListReason.txt";
        try (ObjectOutputStream oos =
                     new ObjectOutputStream(new FileOutputStream(filePath));
        ObjectInputStream ois =
                new ObjectInputStream(new FileInputStream(filePath))) {
            oos.writeObject(slr);
            Object stringList = ois.readObject();

            log.info("stringList: {}", stringList);
        }
    }
}
